#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>

int main()
{
  printf("testexec begin! ...\n");
  
  pid_t id=fork();
  if(id==0)
  {
    char* const argv[]={(char*)"mypragma",NULL};
    char* const envp[]={(char*)"HAHA=111",(char*)"HEHE=222",NULL};
    extern char**environ;
    sleep(2);
   // execl("./mypragma","mypragma",NULL);
    execvpe("./mypragma",argv,environ);

   // sleep(2);
   // char* const argv[]={"ls","-l","-a","--color",NULL};
    //child
   // execl("/usr/bin/ls","ls","-l","-a",NULL);
   // execv("/usr/bin/ls",argv);
   // execvp("ls",argv);
    exit(1);
  }
  
  //father
  int status=0;
  pid_t rid=waitpid(id,&status,0);
  if(rid>0)
  {
    printf("father wait success,child,exit code:%d\n",WEXITSTATUS(status));
  }
  
  printf("testexec end! ...\n");
  return 0;
}
